# -*- coding = utf-8 -*-
# @Time :2024/2/1 19:32
# @Author :invictusQAQ
# @Description :
# @File :  fixture.py

import pytest
from page_object.login_page import LoginPage
from page_object.register_page import RegisterPage
from page_object.files_page import FilesPage
from selenium import webdriver


@pytest.fixture(scope='class')
def login_fixture():
    option = webdriver.ChromeOptions()
    option.add_experimental_option('detach', True)
    driver = webdriver.Chrome(options=option)
    driver.maximize_window()
    browser = LoginPage(driver)
    yield browser
    browser.driver.quit()


@pytest.fixture(scope='class')
def register_fixture():
    option = webdriver.ChromeOptions()
    option.add_experimental_option('detach', True)
    driver = webdriver.Chrome(options=option)
    driver.maximize_window()
    browser = RegisterPage(driver)
    yield browser
    browser.driver.quit()


@pytest.fixture(scope='class')
def files_fixture():
    option = webdriver.ChromeOptions()
    option.add_experimental_option('detach', True)
    driver = webdriver.Chrome(options=option)
    driver.maximize_window()
    login = LoginPage(driver)
    browser = FilesPage(driver)
    login.login('example', '12345678')
    yield browser
    browser.driver.quit()
